import React from 'react';
import { useModel } from 'umi';
import styles from './index.less';
import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons';

const HeaderContent: React.FC<{}> = () => {
  // const { currentRoute } = useModel('useGlobalModel', (model) => ({
  //   currentRoute: model.currentRoute,
  // }));
  const { initialState, setInitialState } = useModel('@@initialState');

  //layout 展开和收起
  const onCollapse = () => {
    setInitialState({ ...initialState, collapsed: !initialState?.collapsed });
  };

  return (
    <div className={styles['ant-pro-global-header']}>
      <span className={styles['global-header-trigger']} onClick={onCollapse}>
        {!initialState?.collapsed ? <MenuFoldOutlined /> : <MenuUnfoldOutlined />}
      </span>
    </div>
  );
};
export default HeaderContent;
